import Vue from 'vue'
import Router from 'vue-router'
import Index from '@/views/Index'
import About from '@/views/About'
import Honor from '@/views/Honor'
import CorporateCulture from '@/views/CorporateCulture'
import Contact from '@/views/contact'
import IntellectualProperty from '@/views/IntellectualProperty'
import TradeMark  from '@/views/TradeMark'
import IndustryNews  from '@/views/IndustryNews'
import LatestPolicy  from '@/views/LatestPolicy'
import TrademarkClassification  from '@/views/TrademarkClassification'
import TeamElite  from '@/views/TeamElite'
import Detail  from '@/views/Detail'


Vue.use(Router)

export const constantRouterMap = [
    {
      path: '/',
      name: 'Index',
      component: Index
    },
    {
      path: '/about',
      name: 'About',
      component: About
    },
    {
      path: '/honor',
      name: 'Honor',
      component: Honor
    },
    {
      path: '/corporateCulture',
      name: 'CorporateCulture',
      component: CorporateCulture
    },
    {
      path: '/contact',
      name: 'Contact',
      component: Contact
    },
    {
      path: '/intellectualProperty',
      name: 'IntellectualProperty',
      component: IntellectualProperty
    },
    {
      path: '/tradeMark',
      name: 'TradeMark',
      component: TradeMark
    },
    {
      path: '/industryNews',
      name: 'IndustryNews',
      component: IndustryNews
    },
    {
      path: '/latestPolicy',
      name: 'LatestPolicy',
      component: LatestPolicy
    },
    {
      path: '/trademarkClassification',
      name: 'TrademarkClassification',
      component: TrademarkClassification
    },
    {
      path: '/teamElite',
      name: 'TeamElite',
      component: TeamElite
    },
    {
      path: '/detail',
      name: 'Detail',
      component: Detail
    },
    {
      path: '/edit',
      name: 'Edit',
      component: () => import("@/views/Edit")
    }
  ]
  const router = new Router({
    scrollBehavior: () => ({ y: 0 }),
    routes: constantRouterMap
  })

  router.beforeEach((to, from, next) => {
    console.log(to.path)
    // window.localStorage.setItem('path', to.path)
    next()
  })
  export default router